<template>
<div class="submit_box">
  <a-row :gutter="10">
    <a-col :span="12">
      <a-tab-pane>
        <a-tabs default-active-key="team" >
          <a-tab-pane key="team" title="题目">
            <TeamItem/>
          </a-tab-pane>
          <a-tab-pane key="commend" title="评论">
            <CommentList/>
          </a-tab-pane>
          <a-tab-pane key="ans" title="答案">
            <ShowAnswer />
          </a-tab-pane>
          <a-tab-pane key="submitList" title="提交记录">
            <SubmitTeamList />
          </a-tab-pane>
        </a-tabs>
      </a-tab-pane>
    </a-col>
    <a-col :span="12">
      <DoTeamItem/>
    </a-col>
  </a-row>
</div>
</template>

<script setup lang="ts">
import TeamItem from "@/components/TeamItem.vue";
import DoTeamItem from "@/components/DoTeamItem.vue";
import { onMounted } from "vue";
import { useRoute } from "vue-router";
import { QuestionControllerService } from "../../generated";
import { Message } from "@arco-design/web-vue";
import router from "@/router";
import { useStore } from "vuex";
import CommentList from "@/components/CommentList.vue";
import SubmitTeamList from "@/components/SubmitTeamList.vue";
import ShowAnswer from "@/components/ShowAnswer.vue";

const store = useStore();
onMounted( async() => {
  let route = useRoute();
  const id:any = route.query?.id;
  if (id >= 0) {
    let res = await QuestionControllerService.getQuestionByIdUsingGet(id);
    if (res.code === 0) {
      // 将题目信息赋值
      store.dispatch('team/setCurEditTeam', res.data)
    }else {
      // 跳转失败
      Message.error(res.msg);
      // 跳转登录页面
      await router.push({ path: "/user/login" })
    }
  }
})

</script>

<style scoped>
.submit_box {
  min-height: 730px;
}
</style>